import pandas as pd

df = pd.DataFrame({
    '商品': ['苹果', '香蕉', '梨', '香蕉'],
    '单价': [4, 5, 4, 5],
    '销量': [100, 120, 105, 120],
    '库存': [50, 60, 70, 60]
})

print("原始数据:")
print(df)

print("\n默认去重(保留首次出现的重复行):")
print(df.drop_duplicates())

print("\n去重(保留最后一次出现的重复行):")
print(df.drop_duplicates(keep='last'))

print("\n去重(不保留任何重复行):")
print(df.drop_duplicates(keep=False))

print("\n去重并重置索引:")
print(df.drop_duplicates(keep=False, ignore_index=True))
